#pragma once

#include "SDL.h"
#include <Windows.h>

class SDLInput
{
public:
	static SDLInput* GetInstance()
	{
		if(instance == NULL)
		{
			instance = new SDLInput();
		}
		return instance;
	}

	static void Kill()
	{
		if(instance != NULL)
		{
			delete instance;
			instance = NULL;
		}
	}

	void Poll();
	bool KeyDown(int i);
	char& Key(int i)		{return key[i];}
	int MouseX()			{return mousex;}
	int MouseY()			{return mousey;}
	int MouseXrel()			{return mousexrel;}
	int MouseYrel()			{return mouseyrel;}
	int MouseButton(int i)	{return mousebuttons[i];}
	bool MouseButtonDown(int i);
	int Quit()				{return quit;}

private:
	static SDLInput* instance;

	char key[SDLK_LAST];
	char lastKey[SDLK_LAST];
	int mousex,mousey;
	int mousexrel,mouseyrel;
	char mousebuttons[8];
	char lastmousebuttons[8];
	const int mouseBtnMax;
	char quit;

	SDLInput();
	~SDLInput();
};

